// 放置共享的类型
/*
  通用的接口格式
  {
    message:'ok',
    data: 接口的数据
  }
*/

/*
  当前登录接口的具体返回格式
  {
    token:'xxx',
    refresh_token: 'xxx'
  }
*/
// token接口类型
export type TokenInfo = {
  token: string
  refresh_token: string
}

// 登录表单类型
export type LoginForm = {
  mobile: string
  code: string
}

// 用户中心信息
export type User = {
  id: string
  name: string
  photo: string
  art_count: number
  follow_count: number
  fans_count: number
  like_count: number
}

// 用户个人资料
export type UserProfile = {
  id: string
  photo: string
  name: string
  gender: string
  birthday: string
  intro: string
}

// 频道数据类型
export type ChannelItem = {
  id: number
  name: string
}

export type ChannelRes = {
  channels: ChannelItem[]
}

// 文章列表
export type ArticleItemType = {
  art_id: string
  title: string
  aut_id: string
  aut_name: string
  comm_count: number
  pubdate: string
  is_top: number
  cover: {
    type: 0 | 1 | 3
    images: string[]
  }
}

export type Article = {
  pre_timestamp: string
  results: ArticleItemType[]
}

export type SuggestDataRes = {
  options: string[]
}

export type SearchResultRes = {
  page: number
  per_page: number
  results: ArticleItemType[]
  total_count: number
}

// 文章详情
export type ArticleDetail = {
  art_id: string
  title: string
  pubdate: string
  aut_id: string
  aut_name: string
  aut_photo: string
  is_followed: boolean
  attitude: number
  content: string
  is_collected: boolean
  // 接口中缺失
  comm_count: number
  like_count: number
  read_count: number
}

// 评论项的类型
export type ArtComment = {
  com_id: string
  aut_id: string
  aut_name: string
  aut_photo: string
  like_count: number
  reply_count: number
  pubdate: string
  content: string
  is_liking: boolean
  is_followed: boolean
}
// 文章评论的类型
export type ArticleComment = {
  total_count: number
  end_id: string | null
  last_id: string | null
  results: ArtComment[]
}

// 通用的ApiRes泛型结构

export type ApiRes<T> = {
  message: string
  data: T
}
